import axiosObj from "../../component/interceptor.js";

new Vue({
    el: "#app",
    data: function() {
        return {
            adminImgUrl: "F:\SPM\shop-system_front\public\assets\img.jpg",
            tabPosition: 'left',
            currentTab: 'storeApproval',
            tableStoreData: [],
        }
    },

    methods: {
        handleTabClick(tab) {
            this.currentTab = tab.name;
            if (tab.name === 'storeApproval') {
                this.handleGetStore();
            }
        },

        handleGetStore() {
            const _this = this
            axiosObj({
                url: "/admin/store/info/getByStatus?storeStatus=2",
                method: "get",
            }).then(function(result) {
                _this.tableStoreData = result.data.data
                console.log(_this.tableStoreData)
            })
        },

        handleApprove(flag, storeId) {
            const _this = this
            axiosObj({
                url: "/admin/store/approve?approve=" + flag + "&storeId=" + storeId,
                method: "get",
            }).then(function(result) {
                console.log(result)
                if (result.data.code === 1000) {
                    _this.$message.success("审批成功")
                }

                _this.handleGetStore()
            })

        }
    },

    mounted() {
        this.handleGetStore();
    },
})
